#!/data/mrzeroliu/php/bin/php
<?php
define('PROTOCOL', getprotobyname("tcp"));
define('IP', '10.6.207.197');
define('PORT', 8008);
define('MAX_CONNECTION', 10);
define('BUFFER_SIZE', 1024);

if(!($socket = socket_create(AF_INET, SOCK_STREAM, PROTOCOL)))
{
	echo 'Can\'t create socket';
	retrun;
}

if(!socket_connect($socket, IP, PORT))
{
	echo 'Can\'t connect IP:' . IP . ' PORT:' . PORT;
	return;
}

$content = "aaabbb";

if(socket_write($socket, $content, strlen($content)) === FALSE)
{
	echo 'Can\'t write to the server IP:' . IP . ' PORT:' . PORT;
	return;
}
$out = socket_read($socket, BUFFER_SIZE);
echo $out;
echo "\r\n";